<?php

Solar::loadClass('Solar_App');

class Domain51_App_S3 extends Solar_App
{
    protected $_action_default = 'browse';
    protected $_layout = '';
    public function actionBrowse() {
        $this->_view = null;
        
        $s3 = Solar::factory('Domain51_Service_Amazon_S3');



        
        /* header('Content-Type:text/html');
        var_dump($s3->bucket->put('/new-api-test/' . time())); */ 
        /* */
        
        /* header('Content-Type:text/xml');
        echo $s3->bucket->get('/new-api-test/', array(
            'max-keys' => 3
        )); */
        
        /* var_dump($s3->bucket->put('/new-api-test/1162670407'));
        var_dump(
            $s3->bucket->delete('/new-api-test/1162670407')
        ); */
        
        /* $object = $s3->create('object');
        $object->setFile('/home/tswicegood/work/d51Solar/trunk/TODO');
        $object->bucket = '/new-api-test';
        var_dump($s3->object->put($object)); */
        
        /* $object = $s3->object->get('/new-api-test/TODO');
        echo "<pre>";
        var_dump($object->toArray()); */
        
        
        echo "<pre>";
        /* var_dump($s3->object->head('/new-api-test/1162670283'));
        var_dump($s3->bucket->put('/mashery-wiki')); */
        
        $object = $s3->create('object');
        //$object->setFile('/home/tswicegood/work/d51Solar/trunk/TODO'); // text file
        //$object->setFile('/home/tswicegood/Desktop/SoMo_01.jpg'); // jpg
        $object->setFile('/home/tswicegood/Desktop/Catchall/heart.png');
        $object->name = 'images/heart.png';
        $object->bucket = '/new-api-test';
        $object->headers['x-amz-acl'] = 'public-read';
        //var_dump($object->headers);
        var_dump($s3->object->put($object)); 
        
        var_dump($s3->object->head('/new-api-test/heart.png'));
        //var_dump($s3->object->delete('/new-api-test/TODO')); 
        /* */
    }
}

?>